#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;

int val = 100;

int main()
{
    pid_t id = fork();
    if(id == 0){
        int cnt = 4;
        while(1){
            printf("I am child,ppid : %d,pid : %d,val : %d,addr : %p\n",getppid(),getpid(),val,&val);
            if(cnt){
                cnt--;
            }
            else{
                val = 200;
                cnt--;
            }
            sleep(1);
        }
    }
    else{
        while(1){
            printf("I am father,ppid : %d,pid : %d,val : %d,addr : %p\n",getppid(),getpid(),val,&val);
            sleep(1);
        }
        
    }
}

//int main(int argc,char *argv[],char *env[])
//{
//    int a = 0;
//    while(env[a]){
//        cout << a << "->" << env[a++] << endl;
//    }
//    return 0;
//}
